package cn.tedu.controller;

import cn.tedu.pojo.entity.User;
import cn.tedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 *
 * @author zq
 * @version 1.0
 * @create 2024-08-03 15:42
 * @since jdk1.8
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/insertUser")
    public void insertUser(User user) {
        user.setUsername("张三");
        user.setPassword("123456");
        user.setNickname("老张");
        user.setCreated(new Date());
        System.out.println(user);
        userService.insertUser(user);
    }
    @GetMapping("/hello")
    public String selectUser(Integer id) {
        return "hello,World";
    }

}
